﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace HCI.Questionaire.Entities
{
    public abstract class ConsequenceQuestion : Question
    {
        private Question m_ParentQuestion;
        private int m_DefaultNextIndex = -1;
        public int DefaultNextIndex
        {
            get { return m_DefaultNextIndex; }
            set { m_DefaultNextIndex = value; }
        }
        public Question ParentQuestion
        {
            get { return m_ParentQuestion; }
            set { m_ParentQuestion = value; }
        }
        public virtual int GetNextQuestionIndex()
        {
            if (this.AnswerCollection != null)
            {
                foreach (ConsequenceAnswer item in this.AnswerCollection)
                {
                    if (item.IsAnswered)
                        return item.NextQuestionIndex;
                }
                if (this.DefaultNextIndex != -1)
                    return this.DefaultNextIndex;
            }
            return -1;
        }

        public ValidFromParent ParentRelateValidate { get; set; }

        public delegate bool ValidFromParent();
    }
}
